import Koa from 'koa'
import Router from 'koa-router'
import views from 'koa-views'

import path from 'path'
const __dirname = path.resolve();


class Server {
    #port = 3080
    index = async ctx => {
        await ctx.render('index')
    }

    constructor() {
        const router = new Router()
        router.get('/', this.index)

        new Koa()
            .use(views(__dirname))
            .use(router.routes())
            .listen(
                this.#port,
                _ => console.log(`Server running on http://localhost:${this.#port}`));
    }
}

new Server();
